#include "func.h"


int main(int argc,char *argv[])
{
    MYSQL *conn;
    //mysql与linux在同一台机器可用localhost否则用IP
    const char *server="localhost";
    const char *user="root";
    const char *password="123";
    const char *database="test";
    char query[200]="delete from pet where owner='lule'";
    int t;
    conn=mysql_init(NULL);
    if(!mysql_real_connect(conn,server,user,password,database,0,NULL,0))
    {
        printf("Error connecting to database:%s\n",mysql_error(conn));        
    }else{
        printf("Conndected...\n");
    }
    t=mysql_query(conn,query);
    if(t)
    {
        printf("Error making query:%s\n",mysql_error(conn));
    }else{
        printf("delete success,delete row=%ld\n",(long)mysql_affected_rows(conn));
    }
    mysql_close(conn);
    return 0;
}